{template 'common/header'}
<div class="main">
	<ul class="nav nav-tabs">
		<li><a href="{php echo $this->createWebUrl('question', array('id'=>$sinfo['rid']));}">问题列表</a></li>
		<li class="active"><a href="{php echo $this->createWebUrl('question_add', array('sid'=>$sinfo['sid']))}">添加问题</a></li>
	</ul>

	{template 'survey_info'}
	<form action="" class="form-horizontal form" method="post" enctype="multipart/form-data">
		<input type="hidden" name="sqid" value="{$item['sqid']}">
		<input type="hidden" name="sid" value="{$sinfo['sid']}">
		<input type="hidden" name="token" value="{$_W['token']}" />
		<div class="panel panel-default">
			<div class="panel-heading">
				添加调研问题
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">问题</label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="title" value="{$item['title']}" />
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">描述</label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="description" value="{$item['description']}" />
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">表单类型</label>
					<div class="col-sm-8">
						<label class="radio-inline" for="i_radio">
							<input type="radio" id="i_radio" value="radio" name="type" {if $item['type']=='radio'}checked{/if}> 单选
						</label>
						<label class="radio-inline" for="i_checkbox">
							<input type="radio" id="i_checkbox" value="checkbox" name="type" {if $item['type']=='checkbox'}checked{/if}> 多选
						</label>
						<label class="radio-inline" for="i_select">
							<input type="radio" id="i_select" value="select" name="type" {if $item['type']=='select'}checked{/if}> 下拉选择
						</label>
						<label class="radio-inline" for="i_text">
							<input type="radio" id="i_text" value="text" name="type" {if $item['type']=='text'}checked{/if}> 单行输入
						</label>
						<label class="radio-inline" for="i_textarea">
							<input type="radio" id="i_textarea" value="textarea" name="type" {if $item['type']=='textarea'}checked{/if}> 多行输入
						</label>

					</div>
				</div>

				<div class="form-group {if $item['type']=='text' || $item['type']=='textarea'} hide{/if}" id="extra_box">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">参数</label>
					<div class="col-sm-8">
						<textarea id="reply-add-text" name="extra" class="form-control" style="height:100px;">{$item['extra']}</textarea>
						<span class="help-block">
							<p><strong class="text-danger">参数说明：</strong>字段类型为单选、多选、下拉选择的参数格式每行一项!</p>
						</span>
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">默认值</label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="defvalue" value="{$item['defvalue']}" />
					</div>
				</div>

				<div class="form-group hide">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">验证规则</label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="rule" value="{$item['rule']}" />
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否必填</label>
					<div class="col-sm-8">
						<label class="radio-inline" for="is_must_1">
							<input type="radio" id="is_must_1" value="1" name="is_must" {if $item['is_must']=='1'}checked{/if}> 是
						</label>
						<label class="radio-inline" for="is_must_0">
							<input type="radio" id="is_must_0" value="0" name="is_must" {if $item['is_must']=='0'}checked{/if}> 否
						</label>
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">后台列表显示</label>
					<div class="col-sm-8">
						<label class="radio-inline" for="is_show_1">
							<input type="radio" id="is_show_1" value="1" name="is_show" {if $item['is_show']=='1'}checked{/if}> 是
						</label>
						<label class="radio-inline" for="is_show_0">
							<input type="radio" id="is_show_0" value="0" name="is_show" {if $item['is_show']=='0'}checked{/if}> 否
						</label>
						<span class="help-block">
							<p><strong class="text-danger">说明：</strong>是否在后台调研报告详细列表页显示此字段!</p>
						</span>
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="sort" value="{$item['sort']}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">&nbsp;</label>
					<div class="col-sm-9">
						<button type="submit" class="btn btn-primary col-lg-1" name="submit" value="提交">提交</button>
					</div>
				</div>
			</div>
		</div>

	</form>
</div>
<script language='javascript' type="text/javascript">
$(function () {
	$(".radio-inline").on('click', function(){
		if( $(this).attr('for') == 'i_text' || $(this).attr('for') == 'i_textarea' ){
			$("#extra_box").addClass('hide');
		} else {
			$("#extra_box").removeClass('hide');
		}
	})
});

    
</script>
{template 'common/footer'}